{layout name="admin:layout" /}
<div id="actionbar">
    <a href="{:url('system/admin.miniapp/add')}" class="button button-blue"><i class="iconfont icon-add_icon"></i>创建新应用</a>
</div>
<table class="table">
<thead>
    <tr>
        <th class="w160 fn-tac">操作</th>
        <th class="w50"></th>
        <th>应用名称</th>
        <th class="w200">应用类型</th>
        <th class="w100 fn-tac">应用方式</th>
        <th class="w160">开通价格</th>
        <th class="w100">应用目录</th>
        <th class="w100">版本</th>
        <th class="w70 fn-tac">状态</th>
        <th class="w160 fn-tac">操作</th>
    </tr>
</thead>
<tbody>
{foreach $diff as $rs}
    <tr>
        <td>
            <a class="button button-disabled"><i class="iconfont icon-my_icon"></i>客户</a>
            <a class="button button-disabled"><i class="iconfont icon-my_icon"></i>管理</a>
        </td>
        <td><img class="w40" src="__STATIC__/{$rs['miniapp_dir']}/logo.png"></td>
        <td>{$rs.name}</td>
        <td>{switch $rs.types}
                {case mp}公众号{/case}
                {case program}小程序{/case}
                {case app}APP{/case}
                {case mp_program}小程序/公众号{/case}
                {case mp_program_app}小程序/公众号/APP{/case}
                {default /}<span class="badge">应用异常</span>
            {/switch} 
        </td>
        <td class="fn-tac">{if $rs.is_openapp}<span class="badge bg-green">独立应用</span>{else}<span class="badge bg-blue">开放平台</span>{/if}</td>
        <td>￥0.00</td>
        <td>{$rs['miniapp_dir']}</td>
        <td>{$rs.version}</td>
        <td class="fn-tac"><span class="badge bg-red">待安装</span></td>
        <td class="button-group">
            <a class="button button-disabled"><i class="iconfont icon-edit"></i>设置</a>
            <a class="button button-red install" url="{:url('system/admin.miniapp/install',['dir' => $rs.miniapp_dir])}"  href="javascript:;"><i class="iconfont icon-add_icon"></i>安装</a>
        </td>
    </tr>
{/foreach}
{foreach $list as $rs}
    <tr>
        <td class="button-group">
            <a class="button button-green" href="{:url('system/admin.miniapp/authorizar',['miniapp_id' => $rs->id])}"><i class="iconfont icon-my_icon"></i>客户</a>
            {if $rs.is_manage}<a class="button button-yellow isManage" href="javascript:;" url="{:url('system/admin.miniapp/manage',['id' => $rs->id])}" >
            {else}<a class="button button-disabled">{/if}<i class="iconfont icon-setup_icon"></i>管理</a>
        </td>
        <td class="fn-tac"><img class="w40" src="__STATIC__/{$rs.miniapp_dir}/logo.png"></td>
        <td><a href="{:url('system/admin.miniapp/authorizar',['miniapp_id' => $rs->id])}">{$rs.title}</a></td>
        <td>
            {switch $rs.types}
            {case mp}公众号{/case}
            {case program}小程序{/case}
            {case app}APP{/case}
            {case mp_program}小程序/公众号{/case}
            {case mp_program_app}小程序/公众号/APP{/case}
            {default /}<span class="badge">应用异常</span>
            {/switch}   
        </td>
        <td class="fn-tac">{if $rs.is_openapp}<span class="badge bg-green">独立应用</span>{else}<span class="badge bg-blue">开放平台</span>{/if}</td>
        <td>￥{$rs.sell_price}</td>
        <td>{$rs.miniapp_dir}</td>
        <td>{$rs.version}</td>
        <td class="fn-tac">
            <a class="isLock" url="{:url('system/admin.miniapp/islock',array('id'=>$rs.id))}" href="javascript:;" title="锁定/解锁">
            {if $rs.is_lock}<span class="badge bg-red">锁定</span>{else}<span class="badge">正常</span>{/if}</a>
        </td>
        <td class="button-group">
            <a class="button" href="{:url('system/admin.miniapp/edit',['id'=>$rs->id])}"><i class="iconfont icon-edit"></i>设置</a>
            <a class="button isDel" url="{:url('system/admin.miniapp/delete',['id'=>$rs->id])}" href="javascript:;"><i class="iconfont icon-lajixiang"></i>删除</a>
        </td>
    </tr>
{/foreach}
</tbody>
</table>
<div class="page">{$list|raw}</div>
<script type="text/javascript">
Do('base','layer',function(){
    $('.isDel').isDel();
    $('.isLock').actUrl()
    $('.install').actUrl({'msg':'确定安装当前应用吗？'})
    $('.isManage').actUrl({'msg':'切换管理当前应用','parent':true});
})
</script>